import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/home/duty/schedule_time_entity.dart';

ScheduleTimeEntity $ScheduleTimeEntityFromJson(Map<String, dynamic> json) {
  final ScheduleTimeEntity scheduleTimeEntity = ScheduleTimeEntity();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    scheduleTimeEntity.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    scheduleTimeEntity.updateTime = updateTime;
  }
  final String? creator = jsonConvert.convert<String>(json['creator']);
  if (creator != null) {
    scheduleTimeEntity.creator = creator;
  }
  final String? updater = jsonConvert.convert<String>(json['updater']);
  if (updater != null) {
    scheduleTimeEntity.updater = updater;
  }
  final bool? deleted = jsonConvert.convert<bool>(json['deleted']);
  if (deleted != null) {
    scheduleTimeEntity.deleted = deleted;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    scheduleTimeEntity.id = id;
  }
  final int? companyId = jsonConvert.convert<int>(json['companyId']);
  if (companyId != null) {
    scheduleTimeEntity.companyId = companyId;
  }
  final int? timeType = jsonConvert.convert<int>(json['timeType']);
  if (timeType != null) {
    scheduleTimeEntity.timeType = timeType;
  }
  final String? value = jsonConvert.convert<String>(json['value']);
  if (value != null) {
    scheduleTimeEntity.value = value;
  }
  final String? fillInTime = jsonConvert.convert<String>(json['fillInTime']);
  if (fillInTime != null) {
    scheduleTimeEntity.fillInTime = fillInTime;
  }
  final bool? isOnClick = jsonConvert.convert<bool>(json['isOnClick']);
  if (isOnClick != null) {
    scheduleTimeEntity.isOnClick = isOnClick;
  }
  return scheduleTimeEntity;
}

Map<String, dynamic> $ScheduleTimeEntityToJson(ScheduleTimeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['creator'] = entity.creator;
  data['updater'] = entity.updater;
  data['deleted'] = entity.deleted;
  data['id'] = entity.id;
  data['companyId'] = entity.companyId;
  data['timeType'] = entity.timeType;
  data['value'] = entity.value;
  data['fillInTime'] = entity.fillInTime;
  data['isOnClick'] = entity.isOnClick;
  return data;
}

extension ScheduleTimeEntityExtension on ScheduleTimeEntity {
  ScheduleTimeEntity copyWith({
    String? createTime,
    String? updateTime,
    String? creator,
    String? updater,
    bool? deleted,
    int? id,
    int? companyId,
    int? timeType,
    String? value,
    String? fillInTime,
    bool? isOnClick,
  }) {
    return ScheduleTimeEntity()
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..creator = creator ?? this.creator
      ..updater = updater ?? this.updater
      ..deleted = deleted ?? this.deleted
      ..id = id ?? this.id
      ..companyId = companyId ?? this.companyId
      ..timeType = timeType ?? this.timeType
      ..value = value ?? this.value
      ..fillInTime = fillInTime ?? this.fillInTime
      ..isOnClick = isOnClick ?? this.isOnClick;
  }
}